﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace CloudPms.Common.LogProvider
{
    public interface IModelBase<T> where T : class,new()
    {
        DbContext GetContext(string dbKey);

        DbContext GetContext();

        T Create();

        T Insert(T entity);

        void BatchInsert(IEnumerable<T> entities);

        T Update(T entity);

        void BatchUpdate(IEnumerable<T> entities);

        void Delete(T entity);

        void BatchDelete(IEnumerable<T> entities);

        T Find(params object[] keyValues);

        T Find(Expression<Func<T, bool>> exp);

        IList<T> FindAll();

        IList<T> BatchFind(Expression<Func<T, bool>> exp);

        bool ParamsIsValid(object[] keyValues);
    }
}
